
package com.java.activiti.service;



import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.util.List;
import java.util.zip.ZipInputStream;
import java.util.Map;
/**
 * @Company: PcGroup.ltd
 * @Author: wei.ye
 * @Date: 2021/1/12 14:48
 * @Modified:2021/1/12 14:48
 * @Description:  Activity的业务服务工具类
 */
public interface ActivityCommonService {
    /**
     *   发布服务 RepositoryService
     * @param inputStream
     * @param resourceName
     * @param deployName
     * @param
     * @return  Deployment 部署后的对象信息
     */
    Deployment deploy(ZipInputStream inputStream, String resourceName, String deployName, String text,String category);

    /**
     * 通过 ProcessInstanceWithId启动流程
     * @param deploymentId
     * @param paramas 启动流程时自带的参数
     * @return
     */
    ProcessInstance startProcessInstanceWithId(String deploymentId,Map <String,Object> paramas);

    /**
     * 任务办理时设置流程变量
     * @param task
     * @param paramas
     * @param comment
     * @param args
     * @return
     */
    boolean completeTask(Task task,Map<String,Object> paramas,String comment,Object ... args);

    /**
     * 通过流程实例id设置流程变量并完成当前步骤
     * @param task
     * @param executionId
     * @param paramas
     * @param comment
     * @param args
     * @return
     */
    boolean completeTask(Task task,String executionId,Map<String,Object> paramas,String comment,Object ... args);

    /**
     * runtimeServie通过processDefinitionId获得唯一的ProcessInstance
     * @param processDefinitionId
     * @param args    processInstanceId以外的参数
     * @return
     */
    ProcessInstance  createProcessInstanceByprocessDefinitionId(String processDefinitionId,String ...args);

    /**
     runtimeServie通过processDefinitionId获得ProcessInstance集合
     * @param processDefinitionId
     * @param args    processInstanceId以外的参数非必须
     * @return
     */
    List<ProcessInstance>   createProcessInstanceListByprocessDefinitionId(String processDefinitionId,String ...args);

    /**
     * taskService 通过processDefinitionID 获得唯一的task
     * @param processDefinitionId
     * @param args     processDefinitionId以外的其他参数非必须
     * @return
     */
    Task createTaskQueryByprocessDefinitionId(String processDefinitionId,String ...args);

    /**
     * taskService 通过processDefinitionID 获得唯一的task
     * @param processDefinitionId
     * @param args     processDefinitionId以外的其他参数非必须
     * @return
     */
    List<Task> createTaskListQueryByprocessDefinitionId(String processDefinitionId,String ...args);

    /**
     *
     * @param deployName
     * @param deployId
     * @param categroy
     * @return
     */
    Deployment  createDeploymentQueryByName(String deployName, String deployId,String categroy) ;
    /**
     * RepositoryService 查询
     * @param deployName
     * @param deployId
     * @param args
     * @return
     */
    List<Deployment> createDeploymentListQueryByName(String deployName,String deployId,String ... args) ;

    ProcessDefinition getCurrentProcessDefination(String processDefinationKey);

    /**
     * 通过processDefinationId和 责任人assignee去获得当前责任人的task信息
     * @param processDefinationId
     * @param assignee
     * @return
     */
    List<Task> getCurrentTaskInstance(String processDefinationId, String assignee);

    /**
     *通过assignee和processDefinationkey来获得属于当前责任人的task act_re_prodef-->act_ru_execution-->
     * act_ru_task
     * @param queryParas:assignee,processDefinationKey
     * @return
     */
    List<Task> findUniqueRuntimeTaskByAssigneeAndprocessDefinationKey(Map<String, Object> queryParas);
}
